
import unittest

from Schedule.ClinicEvaluator import ClinicEvaluator
from Schedule.Doctors import Doctors

class ClinicEvaluatorTestCases(unittest.TestCase):
    def setUp(self):
        self._initCount = dict()
        for i in range(0, len (Doctors().doctorNames)):
            self._initCount[i] = 0;
    
    def test_May1(self):
        
        callIndex = [0, 1, 5, 9, 12, 15, 18, 19, 20, 24, 28, 31, 34, 37, 38, 39, 43, 47, 50, 53, 56, 57, 58, 62, 66, 69, 72, 75, 76, 77, 78]
        clinicIndex = [4, 8, 23, 27, 42, 46, 61, 65, 81]
        
        chromosome = [0, 4, 1, 3, 5, 5, 2, 1, 4, 3, 0, 2, 0, 2, 1, 3, 1, 1, 5, 2, 3, 1, 4, 0, 0, 1, 4, 2, 4, 2, 4, 5, 2, 4, 0, 3, 3, 1, 4, 5, 3, 0, 1, 1, 1, 4, 2, 1, 3, 5, 5, 3, 3, 2, 1, 3, 4, 1, 3, 1, 0, 5, 5, 2, 0, 4, 0, 1, 3, 2, 0, 3, 1, 5, 4, 2, 2, 3, 0, 5, 2, 1]
        
        score = ClinicEvaluator(callIndex, clinicIndex, self._initCount).evaluate(chromosome, False)
        
        self.assertEqual(score, 6)
        
    def test_MaximumScore(self):
        
        callIndex = []
        clinicIndex = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
        
        chromosome = [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]
        
        score = ClinicEvaluator(callIndex, clinicIndex, self._initCount).evaluate(chromosome, False)
        
        self.assertEqual(score, 11)
        
    def test_MinimumScore(self):
        
        callIndex = []
        clinicIndex = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
        
        chromosome = [0 for x in range(12)]
        
        score = ClinicEvaluator(callIndex, clinicIndex, self._initCount).evaluate(chromosome, False)
        
        self.assertEqual(score, 0)
        
